<template>
  <div v-loading="loading">
    <p class="title">热门歌手</p>
    <ul class="singerBox">
      <router-link
        tag="li"
        :to="{ name: 'singerdetail', query: { id: item.id, name: item.name } }"
        v-for="item in singerList"
        :key="item.id"
      >
        <img :src="item.img1v1Url" alt="" />
        <p>{{ item.name }}</p>
      </router-link>
    </ul>
  </div>
</template>

<script>
import { gerSinger } from "@/api";
export default {
  data() {
    return {
      loading: false,
      singerList: [],
    };
  },
  created() {
    this.getData();
  },
  methods: {
    getData() {
      this.loading = true;
      gerSinger({ limit: 6 }).then((res) => {
        this.loading = false;
        this.singerList = res.artists;
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.title {
  color: #333;
  height: 23px;
  margin-bottom: 20px;
  border-bottom: 1px solid #ccc;
  font-weight: 700;
}
.singerBox {
  display: flex;
  flex-wrap: wrap;
  margin-left: -25px;
  li {
    padding-left: 25px;
    color: #333;
    margin-bottom: 20px;
    img {
      width: 50px;
      height: 50px;
    }
    p {
      width: 50px;
      text-align: center;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
  }
}
</style>